package jgl.vajra.kingkong.part.mine.viewModel;

import java.util.Map;

import jgl.vajra.kingkong.bean.InvitePrizeBalanceBean;
import jgl.vajra.kingkong.part.mine.contract.InvitePrizeContract;
import jgl.vajra.kingkong.part.mine.model.InvitePrizeModel;
import jgl.vajra.kingkong.widget.mvvm.factory.CreateModel;
import jgl.vajra.kingkong.widget.retrofithelper.rxsubscriber.ProgressObserver;
import jgl.vajra.kingkong.widget.utils.ToastUtils;

@CreateModel(InvitePrizeModel.class)
public class InvitePrizeViewModel extends InvitePrizeContract.ViewModel{
    @Override
    public void getInvitePrizeBalanceData(Map<String, Object> map) {
        mModel.getInvitePrizeBalanceData(map).subscribe(new ProgressObserver<InvitePrizeBalanceBean>(false,null) {
            @Override
            public void _onNext(InvitePrizeBalanceBean data) {
                mView.returnInvitePrizeBalanceData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getInvitePrizeOwnerData(Map<String, Object> map) {
        mModel.getInvitePrizeOwnerData(map).subscribe(new ProgressObserver<InvitePrizeBalanceBean>(false, null) {
            @Override
            public void _onNext(InvitePrizeBalanceBean data) {
                mView.returnInvitePrizeOwnerData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getInvitePrizeOperatorData(Map<String, Object> map) {
        mModel.getInvitePrizeOperatorData(map).subscribe(new ProgressObserver<InvitePrizeBalanceBean>(false, null) {
            @Override
            public void _onNext(InvitePrizeBalanceBean data) {
                mView.returnInvitePrizeOperatorData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getInvitePrizeSumData(Map<String, Object> map) {
        mModel.getInvitePrizeSumData(map).subscribe(new ProgressObserver<InvitePrizeBalanceBean>(false, null) {
            @Override
            public void _onNext(InvitePrizeBalanceBean data) {
                mView.returnInvitePrizeSumData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getWithdrawalBalanceData(Map<String, Object> map) {
        mModel.getWithdrawalBalanceData(map).subscribe(new ProgressObserver<String>(false,null) {
            @Override
            public void _onNext(String data) {
                ToastUtils.showShort(data);
                mView.returnWithdrawalBalanceData();
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }
}
